<template>
  <div>
    我是B组件, flag = {{ flag }}
  </div>
</template>

<script setup lang="ts">
import { ref, getCurrentInstance, watch } from "vue"

const instance = getCurrentInstance()
let flag = ref(false)
const Bus = (param: any) => {
  flag.value = param
}
instance?.proxy?.$Bus.on("on-click", Bus)


// off 取消指定的mitt事件
instance?.proxy?.$Bus.off("on-click", Bus)
// all.clear()取消所有的mitt事件
instance?.proxy?.$Bus.all.clear()
</script>

<style scoped>

</style>